//
//  WeeklyChartViewController.m
//  Stock
//
//  Created by blacksun on 11-6-21.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import "WeeklyChartViewController.h"


@implementation WeeklyChartViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - OverWrite Parent
-(void)chartViewDidDisplay{
    if (isDownLoading) {
        return;
    }
    [super chartViewDidDisplay];
    for (MyStock *remoteSotck in panrentController.parentController.remoteStocks) {
        if ([remoteSotck.uuid isEqualToString:panrentController.myStock.uuid]) {
            //remoteTimeStamp = remoteSotck.weeklyChartTime;
            break;
        }
    }
    /*if (!self.imageView.image || panrentController.myStock.weeklyChartTime < remoteTimeStamp) {
        [self.imageDownloader downLoadImageWithUrl:[NSString stringWithFormat:@"%@?id=%@&type=%@",kImageRequestUrl,panrentController.myStock.uuid,chartType]];
        isDownLoading = YES;
    }*/
    
}

-(void)requestFinishedWithResult:(id)aResult andUserinfo:(NSDictionary *)aUserinfo{
    [super requestFinishedWithResult:aResult andUserinfo:aUserinfo];
    self.imageView.image = aResult;
    isDownLoading = NO;
    //panrentController.myStock.weeklyChartTime = remoteTimeStamp;
}
-(void)requestFinishedwithError:(NSError *)aError andUserinfo:(NSDictionary *)aUserinfo{
    isDownLoading = NO;
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    self.chartType = @"weekly";
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
